﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Hotel_application
{
    /// <summary>
    /// Summary description for Upload
    /// </summary>
    public class Upload : IHttpHandler
    {

        //public void ProcessRequest(HttpContext context)
        //{
        //    context.Response.ContentType = "text/plain";
        //    context.Response.Write("Hello World");
        //}

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }

        public void ProcessRequest(HttpContext context)
        {
            try
            {
                HttpPostedFile file = context.Request.Files["FileData"];
                string filename = file.FileName;
                string filepath = HttpContext.Current.Server.MapPath("~").ToString() + "\\Images\\" + filename;
                file.SaveAs(filepath);
            }
            catch (Exception ex)
            {
                //Do Something
            }
        }
    }
}